package com.hp.bon.sgw.wkflow.impl;

import com.hp.bon.sgw.core.CallParam;
import com.hp.bon.sgw.util.dcc.DccAvpHelper;
import com.hp.bon.sgw.wkflow.FlowVarObj;

public class FlowInputVarObj extends FlowVarObj {
	private final CallParam callParam;

	public FlowInputVarObj(CallParam callParam) {
		this.callParam = callParam;
	}

	@Override
	public Object getProperty(String express) {
		if (express.equals("UID")) {
			return callParam.getUserName();
		} else if (express.equals("SCID")) {
			return callParam.getServiceContextId();
		} else if (express.equals("MID")) {
			return callParam.getSessionId();
		} else if (express.equals("realm")) {
			return DccAvpHelper.getRealmPart(callParam.getServiceContextId());
		} else if (express.equals("areacode")) {
			return DccAvpHelper.getArea(callParam.getServiceContextId());
		} else {
			throw new IllegalArgumentException("no such property:" + express);
		}
	}

}
